<template>
  <div id="app">
    <template v-if="route.path.startsWith('/user')">
      <router-view />
    </template>
    <template v-else>
      <BasicLayout />
    </template>
  </div>
</template>

<style scoped>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}

nav a.router-link-exact-active {
  color: #42b983;
}
</style>
<script setup lang="ts">
import BasicLayout from "@/layouts/BasicLayout.vue";
import { useRoute, useRouter } from "vue-router";
import { useStore } from "vuex";
import checkAccess from "@/access/checkAccess";
import { computed, onMounted } from "vue";

const route = useRoute();

/**
 * 全局初始化函数，有全局的一些初始化操作，都可以写到这里
 */
const doInit = async () => {
  // 初始化用户信息
  // await store.dispatch("user/getLoginUser");
  // 初始化路由
  // await router.isReady();
  // 初始化菜单
  // await store.dispatch("menu/initMenu");
  // 初始化完成后，调用next()继续路由导航
  // next();
  // console.log("全局初始化完成");
};

onMounted(() => {
  doInit();
});
</script>
